# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=whapa
pkgver=385.548ca0d
pkgrel=1
pkgdesc='WhatsApp Parser Tool.'
groups=('blackarch' 'blackarch-misc')
arch=('any')
url='https://github.com/B16f00t/whapa'
license=('GPL3')
depends=('python' 'python-colorama' 'python-requests' 'python-gpsoauth'
         'python-pycryptodome' 'tk')
makedepends=('git')
source=("git+https://github.com/B16f00t/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md doc/*.md
  install -Dm 644 doc/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -rf *.md LICENSE doc

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname-gui.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

